The Shiny App I have produced compares the difference in using a linear model as opposed to a quadratic model when the data generated is quadratic.
The formula I used to generate the synthetic data was of form \(y = -0.5x^2 + 10x -18\) and in the range \(x = [3, 18]\). I also generated some gaussian noise to add to the y-term of the form \(y \sim \mathcal{N}(\mu =0, \sigma^2=1)\).
The code to generate this is down below:
x_values <- seq(3, 18, by = 0.1) y_values <- -0.5 * x_values^2 + 10 * x_values - 18 set.seed(123) noise <- rnorm(length(y_values), mean = 0, sd = 1) y_noisy <- y_values + noise data <- data.frame(x = x_values, y = y_noisy)